package com.quanyan.place.service.impl;

import com.quanyan.place.entity.TbBusinessLog;
import com.quanyan.place.mapper.TbBusinessLogMapper;
import com.quanyan.place.service.TbBusinessLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Calendar;

/**
 * 日志Serivice实现类
 *
 * Created by liuyaoxin on 2016/7/11.
 */
@Service("tbBussinessLogService")
public class TbBusinessLogServiceImpl implements TbBusinessLogService {



    @Autowired
    TbBusinessLogMapper tbBusinessLogMapper;

    @Override
    public void insertLogInfo(TbBusinessLog log) {

        tbBusinessLogMapper.insert(log);
    }

    public int insertIntoBusinessLog(Integer entityId, Integer entityType, Integer uid, String logName, String logInfo){
        TbBusinessLog tbBusinessLog = new TbBusinessLog();
        tbBusinessLog.setCreateTime(Calendar.getInstance().getTime());
        tbBusinessLog.setEntityId(entityId);
        tbBusinessLog.setEntityType(entityType); //活动.
        tbBusinessLog.setUid(uid);
        tbBusinessLog.setLogName(logName);
        tbBusinessLog.setLogInfo(logInfo);
        return this.tbBusinessLogMapper.insert(tbBusinessLog);
    }
}
